import { NativeModules } from 'react-native';

import { isIOS } from '../../constant';
import { REACT_NATIVE_JS_READY } from '../../constant/nativeEvent';

const hide = (): void => {
  if (isIOS) {
    NativeModules.SplashScreen.hide();
  } else {
    setTimeout((): void => {
      if (NativeModules.ReactNativeJSEventEmitter) {
        NativeModules.ReactNativeJSEventEmitter.emit(
          REACT_NATIVE_JS_READY,
          null
        );
      }
    }, 500);
  }
};

export default {
  hide
};
